<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
        <title>Database Demo</title>
		<link rel="stylesheet" type="text/css" href="default.css">
        <script type="text/javascript" src="http://www.big5apps.com/api/bigfive.js">
        </script>
        <script type="text/javascript">

            function out(value){
                // alert(value)
                document.getElementById("dbmsg").innerHTML = "MESSAGE:<br />" + value
            }

            function testDatabase(){
                var database = openDatabase("project", "1.0");
                database.transaction(function(tx){
                    tx.executeSql("SELECT COUNT(*) AS ct FROM test", [], function(tx, result){
                        out("Database exists and has " + result.rows.item(0).ct + " entries")
                    }, function(tx, error){
                        tx.executeSql("CREATE TABLE test (data TEXT)", [], function(tx, result){
                            out("Database has been created now")
                            tx.executeSql("INSERT INTO test (data) VALUES (?)", ["test"]);
                        });
                    });
                });
            }

            window.onload = function(){
                testDatabase();
            }
        </script>
    </head>
    <body>
        <h1>Database Demo</h1>
		<a id="back" href="index.html">Back</a>
        <p id="dbmsg">
            ???
        </p>       
    </body>
</html>
